#ifndef GAMEENGINE_GAMEPLAY_STATISTICS_STATISTICS_H
#define GAMEENGINE_GAMEPLAY_STATISTICS_STATISTICS_H

#include <GameEngine/Gameplay/gameplay_settings.h>

#include <GameEngine/Core/Classes/rtti.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//=================================================================================


//! The statistics of an item
/*!
 *  The statistics has a maximum and a current value which can be modified independently.
 *
 *  The statistics can be locked, which forbids client code to modify both its maximum and
 *  current values. This can be useful, e.g., to make an actor temporarily invincible (its
 *  health component would then be locked, preventing him from dying)
 */
class _Gameplay_decl Statistics {
	GAMEENGINE_DECLARE_RTTI_SINGLE(Statistics)

public:
	//! Point to some of the elements of the statistics
	enum StatElement {
		//! Points to the maximum value of the statistics only
		MaximumOnly,
		//! Points to the current value of the statistics only
		CurrentOnly,
		//! Points to the maximum and current values of the statistics
		MaximumAndCurrent
	};

	Statistics();
	Statistics(float maximum_stat, float current_stat = 0.0f);
	Statistics(const Statistics& rhs);
	Statistics& operator=(const Statistics& rhs);
	virtual ~Statistics();

	float maximum_stat() const;
	bool set_maximum_stat(float value);
	float current_stat() const;
	bool set_current_stat(float value);
	bool offset_stat(float value, StatElement type = MaximumAndCurrent);

	bool locked() const;
	bool& locked();

private:
	//! Maximum value for the statistics
	float maximum_stat_;

	//! Current value for the statistics
	float current_stat_;

	//! Indicates whether the statistics is locked
	bool locked_;
};


#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
